﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.TeamFoundation.Build.Client;

namespace UCL.Powersource.TFS
{
    internal class QueuedBuildStatus
    {
        internal readonly Exception PollingException;
        internal readonly IBuildDetail BuildDetail;
        internal readonly bool IsFinalQueuedBuildStatus;

        internal QueuedBuildStatus(Exception exception, IBuildDetail buildDetail)
            : this(exception, buildDetail, false) { }

        public QueuedBuildStatus(Exception exception, IBuildDetail buildDetail, bool isFinalQueuedBuildStatus)
        {
            PollingException = exception;
            BuildDetail = buildDetail;
            this.IsFinalQueuedBuildStatus = isFinalQueuedBuildStatus;
        }

        //internal bool HasFinished
        //{
        //    get { return PollingException != null || (BuildDetail != null && BuildDetail.BuildFinished); }
        //}


        public override string ToString()
        {
            return string.Format("{0} [E:{1},BD:{2}]", this.GetType().Name, this.PollingException, this.BuildDetail);
        }


    }
}
